package com.hfkz.project.serivce;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.hfkz.project.db.JDBCHelper;
import com.hfkz.project.domain.Book;
import com.hfkz.project.domain.Test;

public class BookService {
	
	public List bookQuery(){
		String sql = "select book_id,book_name,book_price,book_author,book_publisher,book_publish_date,book_ISBN,book_total,book_message,book_classify from t_book";
		List<Book> t = JDBCHelper.queryBySql(Book.class, 10, sql, new Object[]{});
		return t;
	}
	
	public List bookQuery(String bookName){
		String sql = "select book_id,book_name,book_price,book_author,book_publisher,book_publish_date,book_ISBN,book_total,book_message,book_classify from t_book";
		List<Book> t = JDBCHelper.queryBySql(Book.class, 10, sql, new Object[]{bookName});
		return t;
	}
	
	public void insert(Book book){
		String sql ="insert into t_book (book_name,book_price,book_author,book_publisher,book_publish_date,book_ISBN,book_total,book_message,book_classify) values(?,?,?,?,?,?,?,?,?)";
		boolean flag = JDBCHelper.execute(sql, new Object[]{book.getBookName(),book.getBookPrice(),book.getAuthor(),book.getPublisher(),book.getPublishDate(),book.getIsbn(),book.getTotal(),book.getMessage(),book.getClassify()});
	}
}